package com.sg.hms.controller;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.sg.hms.Service.FoodMenuService;
import com.sg.hms.ServiceImpl.FoodMenuServiceImpl;
/**
 * 
 * @author 张杨
 *
 */
public class UpdateFoodMenuController extends HttpServlet{
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		// TODO Auto-generated method stub
		super.doPost(req, resp);
	}
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		// TODO Auto-generated method stub
		PrintWriter pw=resp.getWriter();
		FoodMenuService fmservice=new FoodMenuServiceImpl();
		int fmid=Integer.parseInt(req.getParameter("fmid"));
		int price=Integer.parseInt(req.getParameter("price"));
		String fmName=req.getParameter("fmName");
		String content=req.getParameter("content");
		int a=fmservice.updateFoodMenus(fmid, fmName, price, content);
		if (a==1) {
			pw.write("1");
		}
	}
}
